package cn.gy.gift.service.impl;

import cn.gy.gift.domain.Employee;
import cn.gy.gift.mapper.EmployeeMapper;
import cn.gy.gift.query.EmployeeQuery;
import cn.gy.gift.service.IEmployeeService;
import cn.gy.gift.util.PageList;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {


    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public PageList<Employee> selectPageList(EmployeeQuery query) {


        Page<Employee> page = new Page<>(query.getPage(), query.getRows());
        //自定义mapper方法，返回关联数据对象
        List<Employee> data = employeeMapper.loadPageList(page, query);

        return new PageList<>(page.getTotal(),data);


    }
}
